import request from './request'
import { useUserStore } from "../store/modules/user"
// 获取商品单位列表
export function unitList(data: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/unit/getList',
        method: 'post',
        data
    })
}

// 新增或修改单位
export function unitSave(data: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/unit/save',
        method: 'post',
        data
    })
}

// 批量禁用或启用商品单位
export function unitDisable(data: any, status: boolean) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/unit/disable',
        method: 'put',
        data,
        params: { status }
    })
}

// 批量删除商品单位
export function unitDelete(data: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/unit/',
        method: 'delete',
        data,
    })
}

// 获取商品类型列表
export function typeList(data: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/type/getList',
        method: 'post',
        data
    })
}

// 新增或修改商品类型
export function typeSave(data: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/type/save',
        method: 'post',
        data
    })
}

// 批量禁用或启用商品类型
export function typeDisable(data: any, status: boolean) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/type/disable',
        method: 'put',
        data,
        params: { status }
    })
}

// 批量删除商品类型
export function typeDelete(data: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/type/',
        method: 'delete',
        data,
    })
}

// 获取商品规格列表
export function specList(data: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/spec/getList',
        method: 'post',
        data
    })
}

// 新增或修改商品规格
export function specSave(data: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/spec/save',
        method: 'post',
        data
    })
}

// 批量禁用或启用商品规格
export function specDisable(data: any, params: boolean) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/spec/disable',
        method: 'put',
        data,
        params
    })
}

// 批量删除商品规格
export function specDelete(data: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/spec/',
        method: 'delete',
        data,
    })
}

// 获取商品规格信息
export function specInfo(id: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/spec/' + id,
        method: 'get',
    })
}

// 获取商品字段列表
export function fieldList(data: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/field/getList',
        method: 'post',
        data
    })
}

// 新增或修改商品字段
export function fieldSave(data: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/field/save',
        method: 'post',
        data
    })
}

// 批量禁用或启用商品字段
export function fieldDisable(data: any, status: boolean) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/field/',
        method: 'put',
        data,
        params: { status }
    })
}

// 批量删除商品字段
export function fieldDelete(data: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/field/',
        method: 'delete',
        data,
    })
}

// 获取商品字段信息
export function fieldInfo(id: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/field/' + id,
        method: 'get',
    })
}

// 获取商品参数列表
export function paraList(data: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/param/getList',
        method: 'post',
        data
    })
}

// 新增或修改商品参数
export function paraSave(data: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/param/save',
        method: 'post',
        data
    })
}

// 批量禁用或启用商品参数
export function paraDisable(data: any, status: boolean) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/param/',
        method: 'put',
        data,
        params: { status }
    })
}

// 批量删除商品参数
export function paraDelete(data: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/param/',
        method: 'delete',
        data,
    })
}

// 获取参数字段列表
export function paraFieldList(data: any, paramId: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/param/' + paramId,
        method: 'post',
        data
    })
}

// 新增或修改商品参数字段
export function paraFieldSave(data: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/param/saveParamField',
        method: 'post',
        data
    })
}

// 批量禁用或启用商品参数
export function paraFieldDisable(data: any, params: boolean) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/param/disableParamField',
        method: 'put',
        data,
        params
    })
}

// 批量删除参数字段
export function paraFieldDelete(data: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/param/deleteParamField',
        method: 'delete',
        data,
    })
}

// 获取参数字段信息
export function paraFieldInfo(id: any) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        headers: token,
        url: '/goods/set/param/getParamFieldInfo/' + id,
        method: 'get',
    })
}